import http from "@/utils/request";

const apiPrefix = "/freight";



export async function addFreight(data) {
    return await http.request({
        data: data,
        url: apiPrefix,
        method: 'post'
    })
}

export async function deleteFreightById(id){
    return await http.request({
        params: {
            id
        },
        url: apiPrefix+'/id',
        method: 'delete'
    })
}

export async function deleteFreightByIds(ids){
    return await http.request({
        params: {
            ids
        },
        url: apiPrefix+'/batch',
        method: 'delete'
    })
}


export async function searchFreightById(id){
  return await http.request({
    params: {
      id
    },
    url: apiPrefix+'/id',
    method: 'get'
  })
}

export async function searchSpecial(){
  return await http.request({
    url: '/specialValue',
    method: 'get'
  })
}

export async function updateSpecial(orderAutoFinish){
  return await http.request({
    data:{
      orderAutoFinish
    },
    url: '/specialValue',
    method: 'put'
  })
}

export async function searchFreight(params){
    return await http.request({
        params: params,
        url: apiPrefix,
        method: 'get'
    })
}

export async function searchFreightByPage(params){
    return await http.request({
        params: params,
        url: apiPrefix+'/page',
        method: 'get'
    })
}


export async function updateFreightById(data){
    return await http.request({
        data: data,
        url: apiPrefix,
        method: 'put'
    })
}
